import { defineStore } from 'pinia'

export const useAnalysisStore = defineStore('analysis', {
  state: () => ({
    paperData: null
  }),
  getters: {
    // 计算组合后的标题
    paperTitle: (state) => {
      if (!state.paperData) return ''
      return `${state.paperData.type === 1 ? '能力测评' : '单元测试'} · ${state.paperData.version_name} · ${state.paperData.grade_name} · ${state.paperData.term_type_name}`
    }
  },
  actions: {
    setPaperData(data) {
      this.paperData = data
    },
    clearPaperData() {
      this.paperData = null
    }
  }
})